package c.e.a.c.i;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import c.e.a.c.t.g;
import c.e.a.c.t.j;
import c.e.a.c.t.n;
import com.google.android.material.button.MaterialButton;

/* compiled from: MaterialButtonHelper */
public class a {
    public final MaterialButton a;
    public j b;
    public int c;
    public int d;
    public int e;
    public int f;
    public int g;
    public int h;
    public Mode i;
    public ColorStateList j;
    public ColorStateList k;
    public ColorStateList l;
    public Drawable m;
    public boolean n = false;
    public boolean o = false;
    public boolean p = false;
    public boolean q;
    public LayerDrawable r;

    public a(MaterialButton materialButton, j jVar) {
        this.a = materialButton;
        this.b = jVar;
    }

    public n a() {
        LayerDrawable layerDrawable = this.r;
        if (layerDrawable == null || layerDrawable.getNumberOfLayers() <= 1) {
            return null;
        }
        if (this.r.getNumberOfLayers() > 2) {
            return (n) this.r.getDrawable(2);
        }
        return (n) this.r.getDrawable(1);
    }

    public g b() {
        return c(false);
    }

    public final g c(boolean z) {
        LayerDrawable layerDrawable = this.r;
        return (layerDrawable == null || layerDrawable.getNumberOfLayers() <= 0) ? null : (g) ((LayerDrawable) ((InsetDrawable) this.r.getDrawable(0)).getDrawable()).getDrawable(z ^ 1);
    }

    public final g d() {
        return c(true);
    }

    public void e(j jVar) {
        g b;
        this.b = jVar;
        if (b() != null) {
            b = b();
            b.a.a = jVar;
            b.invalidateSelf();
        }
        if (d() != null) {
            b = d();
            b.a.a = jVar;
            b.invalidateSelf();
        }
        if (a() != null) {
            a().setShapeAppearanceModel(jVar);
        }
    }

    public final void f() {
        g b = b();
        g d = d();
        if (b != null) {
            b.s((float) this.h, this.k);
            if (d != null) {
                d.r((float) this.h, this.n ? c.e.a.c.a.i(this.a, 2130968791) : 0);
            }
        }
    }
}
